/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Klient.Model;

import Klient.*;
import java.awt.Color;

/**
 *
 * @author Vaclav.Sraier
 */
public class Model implements Klient.AbstractModel {

    MissileType[] weapons;
    Player me;

    /**
     * Main pro spuštění klienta
     */
    @Override
    public void startClient() {
        initWeapons(weapons);
        initMe(me);
    }

    /**
     *
     * @param p Objekt Player, který reprezentuje hrající osobu (daného klienta)
     */
    private void initMe(Player p) {
        String name = null; //Klient.Graphics.*.getName();
        //TODO ve view udelat okno na ziskavani jmena a barvy
        Color color = null;//Klient.Graphisc.*.getColor();
        p = new Player(name, color);
    }

    /**
     * Inicializace zbraní - tj. jejich vytvoreni a definice
     *
     * @param p[] Prázdné pole typu MissileType, do kterého se dají všechny
     * zbraně
     */
    private void initWeapons(MissileType[] p) {
        int howMany = 3;                                    // počet zbraní
        p = new MissileType[howMany];

        p[0] = new MissileType("Small Missile", 25, 20);      // Small Missile
        p[1] = new MissileType("Medium Missile", 50, 25);    // Medium Missile
        p[2] = new MissileType("Large Missile", 100, 50);     // Large Missile

    }

    @Override
    public int getAngle() {
        return me.getTank().angle;
    }

    @Override
    public void startServer() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int getFuel() {
        return me.getTank().fuel;
    }

    @Override
    public MissileType[] getMissileTypes() {
        return this.weapons;
    }

    @Override
    public Player getPlayer(int index) {
        return me;
    }

    @Override
    public int getPower() {
        return me.getTank().force;
    }

    @Override
    public Tank getTank(int index) {
        return me.getTank();
    }

    @Override
    public int getWind() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void goRound(Map map, int startingPlayer) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void goShop() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void healTank(int index) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void init(int rounds, int shopTime, int turnTime, int startingMoney) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void moveTank(int index, int toMove, boolean hasParachute) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void playerShopFinished(int index) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void sendMessage(Message m) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void shoot(int index, Missile missile, int wind) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void skipTurn() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
